﻿using UnityEngine;
using Debug = UnityEngine.Debug;

namespace UnityEditor.Library
{
    public partial class EditorUtils : ScriptableObjectUtils
    {
        /// <summary>
        /// 内容复制到剪切板
        /// </summary>
        /// <param name="content"></param>
        public static void CopyToClipboard(string content)
        {
            Debug.Log(content);
            try
            {
                TextEditor te = new TextEditor();
#if UNITY_5_3_OR_NEWER
            te.text = content;
#else
                te.content = new GUIContent()
                {
                    text = content
                };
#endif
                te.SelectAll();
                te.Copy();
            }
            catch
            {
                // ignored
            }
        }
    }
}
